package a08_StringDemo;

/**
 * @Author quan
 * @Description 字符串的替换replace
 * @Date 2023/1/30 0:38
 */
public class StrReplace {
    public static void main(String[] args) {
        String talk = "你好,你真好哦,你特别好,谢谢,哦";
        //定义一个替换的词库
        String[] arr = {"哦","谢谢"};
        //循环替换
        for (int i = 0; i < arr.length; i++) {
            talk = talk.replace(arr[i], "***");
        }
        System.out.println(talk);
    }
}
